package cn.novel.bm;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.builders.ServerBuilder;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Server;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * Created on 2020/7/16 12:39 下午
 *
 * @author barry
 * Description:
 */
@EnableOpenApi
@SpringBootApplication
public class NovelApplication {

    public static void main(String[] args) {
        SpringApplication.run(NovelApplication.class, args);
    }

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.OAS_30).servers(server()).apiInfo(apiInfo()).select()
                .apis(RequestHandlerSelectors.basePackage("cn.novel.bm"))
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("北冥有声小说")
                .description("这是SWAGGER_2生成的接口文档")
                .version("v1.0")
                .build();
    }

    private Server server(){
        return new ServerBuilder().url("http://10.0.2.124:8888").name("Base Url").build();
    }
}
